/*
	Copyright (c) 2010 <copyright holders>
	This source code is licensed under The MIT License,
	see the file LICENSE for details.
	*/

#ifndef WORLDPRESENTATION_HPP
#define WORLDPRESENTATION_HPP

#include <boost/scoped_ptr.hpp>
#include <cassert>

#include "ForwardDecls.hpp"
#include "Presentation.hpp"
#include "Spatial.hpp"

namespace spelprog2 {
namespace presentation {

enum WorldPresentationType {
    WP_PLAY,
    WP_REPLAY
};

class WorldPresentation : public Presentation {
    WorldPresentationType type_;
    const sim::Int seed_;
    const std::string name_;
    Ogre::TerrainSceneManager * sceneMan_;
    WorldScene * scene_;
    boost::scoped_ptr<WorldInputHandler> inputHandler_;
    boost::scoped_ptr<gui::WorldGUI> gui_;
    boost::scoped_ptr<CameraMan> cameraMan_;

    bool moveCam_;
    bool mouseInWorld_;
public:
    WorldPresentation(Game & game, sim::Int seed, const std::string & scenarioName);
    WorldPresentation(Game & game, const std::string & replayName);
    virtual ~WorldPresentation();

    virtual void initScene();
    virtual void initCameraManager();
    virtual void initGUI();
    virtual Ogre::SceneManager & getSceneManager() { assert(sceneMan_); return (Ogre::SceneManager &) *sceneMan_; }
    virtual CameraMan & getCameraManager() { assert(cameraMan_); return * cameraMan_; }
    virtual void registerNetListeners() { }
    virtual void unregisterNetListeners() { }

    virtual void update(float deltaTime);

    virtual void keyPressed(const OIS::KeyEvent & ev);
	virtual void keyReleased(const OIS::KeyEvent & ev);

    virtual void mouseMoved(const Ogre::Vector2 & point, const Ogre::Vector2 & normalizedPoint,
        const OIS::MouseEvent & ev);
    virtual void mousePressed(const Ogre::Vector2 & point, const Ogre::Vector2 & normalizedPoint,
        const OIS::MouseEvent & ev, OIS::MouseButtonID id);
    virtual void mouseReleased(const Ogre::Vector2 & point, const Ogre::Vector2 & normalizedPoint,
        const OIS::MouseEvent & ev, OIS::MouseButtonID id);
};

}; //presentation
}; //spelprog2

#endif //WORLDPRESENTATION_HPP
